<!DOCTYPE html>
<html>
<head>
<title>Les promotions</title>
<meta name="viewport" charset="utf-8"
	content="width=device-width, initial-scale=1.0">
<!-- Bootstrap -->
<link href="../css/bootstrap.min.css" rel="stylesheet" media="screen">
<!-- My style -->
<link href="../css/bootstrap.css" rel="stylesheet" media="screen">
<link href="../css/dashboard.css" rel="stylesheet">
<link href="../css/ecran-marketing.css" rel="stylesheet">
<link href="../css/menu-contextuel.css" rel="stylesheet">
</head>
<body>

	<br />
	<br />
	<br />

	<div class="container">


		<div class="navbar navbar-default navbar-fixed-top" role="navigation">
			<div class="container">
				<div class="navbar-header">
					<a href="./vendeur_choix_service.php"> <img class="pull-left"
						src="../img/logo.png" width="125px" height="50px">
					</a>
					<button type="button" class="navbar-toggle" data-toggle="collapse"
						data-target=".navbar-collapse">
						<span class="sr-only">Toggle navigation</span> <span
							class="icon-bar"></span> <span class="icon-bar"></span> <span
							class="icon-bar"></span>
					</button>
					<a class="navbar-brand" href="#"><?php include './affichage_user.php'; ?></a>
				</div>
				<div class="collapse navbar-collapse">
					<ul class="nav navbar-nav navbar-right">
						<li>
							<form name="zeform1" id="bouton"
								action="../action/deconnexionAction.php" method="post">
								<input id="deconnexion" name="deconnexion" type="hidden"
									value="Deconnexion" />
							</form> <a href="#nowhere" onClick="zeform1.submit();">Déconnexion</a>
						</li>
					</ul>
				</div>
				<!--/.nav-collapse -->
			</div>
		</div>

		<br /> <br /> <br />

		<div>
			<div class="col-sm-3 col-md-3" style="height: 800px;">
				<div class="panel-group" id="accordion">

					<!-- promo du moment -->
					<div class="panel panel-default">
						<div class="panel-heading">
							<h4 class="panel-title">
								<a data-toggle="collapse" data-parent="#accordion"
									href="#collapseOne"><span
									class="glyphicon glyphicon-folder-close"> </span> Promotion TOP
									10</a>
							</h4>
						</div>
						<div id="collapseOne" class="panel-collapse collapse in">
							<div class="panel-body">
								<table class="table">
									<!-- Promotion choisi par le gestionnaire faire une boucle  -->
									<?php
									// ---------OBTENIR LES PROMOS DU MOMENT
									require_once ("../services/ResponsableService.php");
									
									$responsableService = new ResponsableService ();
									
									$_SESSION ['listPromotionDuMoment'] = $responsableService->getListPromoArticleDuMoment ();
									
									$listPromoDuMoment = $_SESSION ['listPromotionDuMoment'];
									
									foreach ( $listPromoDuMoment as $promotion ) {
										echo '<tr><td><span class="glyphicon glyphicon-shopping-cart"></span><a href="./marketing_affichage_promo.php?var=' . $promotion->getNumArticle () . '">' . $promotion->getLibelle () . '</a></td></tr>';
									}
									?>
								</table>
							</div>
						</div>
					</div>

					<!-- Autres promos	 -->
					<!-- For each pour chaque type article  -->
					<?php
					require_once ("../services/ResponsableService.php");
					
					$responsableService = new ResponsableService ();
					
					$_SESSION ['listTypeArticle'] = $responsableService->getListTypeArticle ();
					
					$listTypeArticle = $_SESSION ['listTypeArticle'];
					foreach ( $listTypeArticle as $typeArticle ) {
						echo '<div class="panel panel-default">';
						echo '	<div class="panel-heading">';
						echo '	<h4 class="panel-title">';
						
						echo '  <a data-toggle="collapse" data-parent="#accordion"';
						echo '		href="#' . $typeArticle->getLibelleTypeArticle () . '"><span class="glyphicon glyphicon-file"> </span>' . $typeArticle->getLibelleTypeArticle () . '</a>';
						echo '	</h4>';
						echo '  </div>';
						echo '			<!-- For each pour chaque promo choisis -->';
						echo '			<div id="' . $typeArticle->getLibelleTypeArticle () . '" class="panel-collapse collapse">';
						echo '					<div class="panel-body">';
						$_SESSION ['listPromotion'] = $responsableService->getListPromo ( $typeArticle->getLibelleTypeArticle () );
						$listPromo = $_SESSION ['listPromotion'];
						echo '							<table class="table">';
						foreach ( $listPromo as $promotion ) {
							echo '								<tr>';
							echo '									<td><span class="glyphicon glyphicon-shopping-cart"></span><a href="./marketing_affichage_promo.php?var=' . $promotion->getNumArticle () . '">' . $promotion->getLibelle () . '</a></td>';
							echo '								</tr>';
						}
						echo '							</table>';
						echo '					</div>';
						echo '			</div>';
						echo '</div>';
					}
					?>
				</div>
			</div>
		</div>



		<div>
		<?php
		// AFFICHE LA LISTE DES ARTICLES PROMOS DU MOMENT
		require_once ("../services/ResponsableService.php");
		
		$responsableService = new ResponsableService ();
		
		$_SESSION ['listArticlePromo'] = $responsableService->getListPromoDuMoment ();
		
		$listArticle = $_SESSION ['listArticlePromo'];
		
		foreach ( $listArticle as $promotion ) {
			echo '<div class="col-lg-2 col-md-2 col-xs-4 col-sm-3 column productbox"';
			echo '			style="background-color: #F1F1F1;">';
			echo '			<a class="thumbnail" href="#"> <img class="img-responsive"';
			echo '				src="../img/' . $promotion->getNumArticle () . '.jpg" ></a>';
			echo '			<div class="producttitle">' . $promotion->getLibelle () . '</div>';
			echo '			<div class="productprice">';
			echo '				<div class="pricetext">';
			echo '					<strike style="color: #B40404;">' . $promotion->getPrixUnitaire () . ' €</strike>';
			echo '				</div>';
			echo '			</div>';
			echo '			<div class="productprice">';
			echo '				<div class="pull-right">';
			echo '					<a class="btn btn-info btn-sm" href="../action/retirerPromoDuMomentAction.php?numArticle=' . $promotion->getNumArticle () . '">Retirer</a>';
			echo '				</div>';
			$res = $promotion->getPrixUnitaire () - $promotion->getPrixUnitaire () * $promotion->getPourcentagePromo () / 100;
			echo '				<div class="pricetext" style="color: #088A4B">' . number_format ( $res, 2 ) . ' €</div>';
			echo '			</div>';
			echo '		</div>';
		}
		?>
		
	</div>
	</div>
</body>
<footer>
	<script src="http://code.jquery.com/jquery.js"></script>
	<script src="../js/bootstrap.js"></script>

</footer>
</html>